package com.foreveross.bsl.mam.app.application.vo;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

import com.foreveross.bsl.mam.model.application.vo.WidgetVO;

/**
 * 
 * 应用实体
 * 
 * @author tanzhixiong
 * @2013-6-20 @上午10:52:41
 */
@XmlRootElement(name = "appMain")
@XmlAccessorType(XmlAccessType.FIELD)
public class AppMainVo implements Serializable {
	
	private static final long serialVersionUID = 5985646687180509899L;

	private String id;
	
	/**
	 * 应用所属的类别
	 */
	private String categoryid;
	private AppCategoryVo appCategoryVo; // 应用类别 实体

	private String createMessgae;

	/**
	 * 是否有效
	 */
	private int available;

	/**
	 * 应用创建时间
	 */
	private Date create_time;

	/**
	 * 应用修改时间
	 */
	private Date modified_time;

	/**
	 * 应用下载次数
	 */
	private int download_counter;

	/**
	 * 应用标识
	 */
	private String identifier;

	/**
	 * 应用名称
	 */
	private String app_name;

	/**
	 * 应用简介
	 */
	private String discription;

	/**
	 * 构建号
	 */
	private int build;

	/**
	 * 应用图片
	 */
	private String icon;

	private String appKey;

	/**
	 * 应用证书密钥
	 */
	private String secret;

	/** 应用对应的模块列表 */
	private List<WidgetVO> widgets;
	
	/** 应用对应的应用列表 */
	private List<AppMainVo> appMains;

	private List<AppVersionVo> appVersionlist;

	private List cloudList; // CloudFunctionVo

	
	public List<AppMainVo> getAppMains() {
		return appMains;
	}

	public void setAppMains(List<AppMainVo> appMains) {
		this.appMains = appMains;
	}

	public List<AppVersionVo> getAppVersionlist() {
		return appVersionlist;
	}

	public void setAppVersionlist(List<AppVersionVo> appVersionlist) {
		this.appVersionlist = appVersionlist;
	}

	public String getCreateMessgae() {
		return createMessgae;
	}

	public void setCreateMessgae(String createMessgae) {
		this.createMessgae = createMessgae;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public int getAvailable() {
		return available;
	}

	public void setAvailable(int available) {
		this.available = available;
	}

	public Date getCreate_time() {
		return create_time;
	}

	public void setCreate_time(Date create_time) {
		this.create_time = create_time;
	}

	public Date getModified_time() {
		return modified_time;
	}

	public void setModified_time(Date modified_time) {
		this.modified_time = modified_time;
	}

	public int getDownload_counter() {
		return download_counter;
	}

	public void setDownload_counter(int download_counter) {
		this.download_counter = download_counter;
	}

	public String getApp_name() {
		return app_name;
	}

	public void setApp_name(String app_name) {
		this.app_name = app_name;
	}

	public String getCategoryid() {
		return categoryid;
	}

	public void setCategoryid(String categoryid) {
		this.categoryid = categoryid;
	}

	public String getIdentifier() {
		return identifier;
	}

	public void setIdentifier(String identifier) {
		this.identifier = identifier;
	}

	public String getDiscription() {
		return discription;
	}

	public void setDiscription(String discription) {
		this.discription = discription;
	}

	public AppCategoryVo getAppCategoryVo() {
		return appCategoryVo;
	}

	public void setAppCategoryVo(AppCategoryVo appCategoryVo) {
		this.appCategoryVo = appCategoryVo;
	}

	public int getBuild() {
		return build;
	}

	public void setBuild(int build) {
		this.build = build;
	}

	public List<WidgetVO> getWidgets() {
		return widgets;
	}

	public void setWidgets(List<WidgetVO> widgets) {
		this.widgets = widgets;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public List getCloudList() {
		return cloudList;
	}

	public void setCloudList(List cloudList) {
		this.cloudList = cloudList;
	}

	public String getAppKey() {
		return appKey;
	}

	public void setAppKey(String appKey) {
		this.appKey = appKey;
	}

	public String getSecret() {
		return secret;
	}

	public void setSecret(String secret) {
		this.secret = secret;
	}

	/* (non-Javadoc) 之所以覆盖hashcode是为了当对象作为key时，存入hash表结构 能找到桶 相同对象会覆盖
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((appKey == null) ? 0 : appKey.hashCode());
		result = prime * result
				+ ((app_name == null) ? 0 : app_name.hashCode());
		result = prime * result + available;
		result = prime * result + build;
		result = prime * result
				+ ((categoryid == null) ? 0 : categoryid.hashCode());
		result = prime * result
				+ ((create_time == null) ? 0 : create_time.hashCode());
		result = prime * result
				+ ((discription == null) ? 0 : discription.hashCode());
		result = prime * result + download_counter;
		result = prime * result + ((icon == null) ? 0 : icon.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result
				+ ((identifier == null) ? 0 : identifier.hashCode());
		result = prime * result
				+ ((modified_time == null) ? 0 : modified_time.hashCode());
		result = prime * result + ((secret == null) ? 0 : secret.hashCode());
		return result;
	}

	/* (non-Javadoc) 之所以覆盖equals方法 是为了方便List做比较
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		AppMainVo other = (AppMainVo) obj;
		if (appKey == null) {
			if (other.appKey != null)
				return false;
		} else if (!appKey.equals(other.appKey))
			return false;
		if (app_name == null) {
			if (other.app_name != null)
				return false;
		} else if (!app_name.equals(other.app_name))
			return false;
		if (available != other.available)
			return false;
		if (build != other.build)
			return false;
		if (categoryid == null) {
			if (other.categoryid != null)
				return false;
		} else if (!categoryid.equals(other.categoryid))
			return false;
		if (create_time == null) {
			if (other.create_time != null)
				return false;
		} else if (!create_time.equals(other.create_time))
			return false;
		if (discription == null) {
			if (other.discription != null)
				return false;
		} else if (!discription.equals(other.discription))
			return false;
		if (download_counter != other.download_counter)
			return false;
		if (icon == null) {
			if (other.icon != null)
				return false;
		} else if (!icon.equals(other.icon))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (identifier == null) {
			if (other.identifier != null)
				return false;
		} else if (!identifier.equals(other.identifier))
			return false;
		if (modified_time == null) {
			if (other.modified_time != null)
				return false;
		} else if (!modified_time.equals(other.modified_time))
			return false;
		if (secret == null) {
			if (other.secret != null)
				return false;
		} else if (!secret.equals(other.secret))
			return false;
		return true;
	}
}
